package cn.csq.array;

import java.util.Arrays;

/**
 * @author <a href="mailto:csq02198031@alibaba-inc.com">chengshanqing</a>
 * @date 2025/8/19 15:14
 */
public class StaticArrayTest {

    public static void main(String[] args) {
        int[] arr = new int[10];

        arr[0] = 1;
        arr[1] = 0;

        int a = arr[0];
        System.out.println("a = " + a);

        // 随机方案

        // CRUD

        int[] arr1 = new int[10];
        arr[0] = 1;
        arr[1] = 10;


        for (int i = 0; i < 4; i++) {
            arr1[i] = i;
        }
        arr1[5] = 9;
        System.out.println("arr1 = " + Arrays.toString(arr1));

        // 中间插入元素
        for (int i = 4; i >= 2; i--) {
            arr1[i + 1] = arr1[i];
        }
        arr1[2] = 10;
        System.out.println("arr1 = " + Arrays.toString(arr1));

        // append
        int[] arr2 = new int[10];
        for (int i = 0; i <= arr2.length - 1; i++) {
            arr2[i] = i;
        }
        System.out.println("arr2 = " + Arrays.toString(arr2));


    }
}
